package it.uniroma2.controller;

import it.uniroma2.cloud.PROVIDER;

import java.util.HashMap;

public class ReporterChecker {

	private static final ReporterChecker INSTANCE = new ReporterChecker();
	
	private HashMap<String, Double> latencyMean = new HashMap<String, Double>();
	private HashMap<String, Double> movingAverage_1MinLoad = new HashMap<String, Double>();
	private HashMap<String, Integer> howManyInstances = new HashMap<String, Integer>();
		
    private ReporterChecker() {
    	this.latencyMean = new HashMap<String, Double>();
    	this.movingAverage_1MinLoad = new HashMap<String, Double>();
    }
 
    public static ReporterChecker getInstance() {
        return INSTANCE;
    }	
    
	public double getLatencyMean(PROVIDER provider) {
		return latencyMean.get(provider.name());
	}

	public void setLatencyMean(PROVIDER provider, Double latency) {
		this.latencyMean.put(provider.name(), latency);
	}

	public double getMovingAverage_1MinLoad(PROVIDER provider) {
		return movingAverage_1MinLoad.get(provider.name());
	}

	public void setMovingAverage_1MinLoad(PROVIDER provider, Double value) {
		this.movingAverage_1MinLoad.put(provider.name(), value);
	}

	public void setInstancesNum(PROVIDER provider, int howManyWorkerNode) {
		this.howManyInstances.put(provider.name(), howManyWorkerNode);
		
	}
	
	public Integer getInstancesNum(PROVIDER provider) {
		return this.howManyInstances.get(provider.name());
	}

}
